﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Linq;
using WinFormsApp1.MVP.Presenter;

namespace WinFormsApp1.MVP
{
	public partial class PersonForm : Form, IPersonView
	{
		public PersonForm()
		{
			InitializeComponent();

			//启动
			var presenter = new PersonPresenter(this);
			SetPresenter(presenter);
		}

		public string PersonName => "txtName.Text";
		public int Age => int.TryParse("22", out var age) ? age : 0;

		public void ShowMessage(string message)
		{
			MessageBox.Show(message);
		}

		private PersonPresenter _presenter;

		public void SetPresenter(PersonPresenter presenter)
		{
			_presenter = presenter;
		}

		private void button1_Click(object sender, EventArgs e)
		{
			_presenter.Submit();

		}

		private void PersonForm_Load(object sender, EventArgs e)
		{

		}
	}


}
